package cmusm.yuan.jfklearn;

import javafx.application.Application;
import javafx.geometry.Rectangle2D;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.TilePane;
import javafx.stage.Stage;


public class ImageApp extends Application {
    private static final String LOC = "https://www.bekwam.com/images/bekwam_logo_hdr_rounded.png";

    @Override
    public void start(Stage primaryStage) throws Exception {
        Image image2 = new Image(LOC, 360, 360, true, true);
        Image image3 = new Image(LOC, 360, 360, false, true);
        Image image4 = new Image(LOC);

        ImageView iv1 = new ImageView(LOC);
        ImageView iv2 = new ImageView(image2);
        ImageView iv3 = new ImageView(image2);
        ImageView iv4 = new ImageView(image2);

        iv4.setPreserveRatio(true);
        iv4.setFitWidth(360);
        iv4.setFitHeight(360);
        Rectangle2D rectangle = new Rectangle2D(20, 50, 100, 100);
        iv4.setViewport(rectangle);

        TilePane tiles = new TilePane(iv1, iv2, iv3, iv4);
        tiles.setPrefColumns(2);

        Scene scene = new Scene(tiles);

        primaryStage.setTitle("ImageApp");
        primaryStage.setScene(scene);
        primaryStage.show();



    }
}
